/** @jsxImportSource @emotion/react */
import * as React from "react";
import {
    BlobInputList, CheckSwitch, Input, InputDatalist, InputLine, LineColumn, Select, SuffixInput, Text,
} from "customize-easy-ui-component";
import {InspectRecordLayout, InternalItemProps, useItemInputControl,} from "../../common/base";
import {useMeasureInpFilter} from "../../common/hooks";


export const VsProjects默认=[
    {name:'锅炉能效测试综合报告',ha:'Conclusion', do:true},
    {name:'测试工况及说明',ha:"TestInstruction", do:true},
    {name:'测试仪表说明',ha:'InstrumentDesc', do:true},
    {name:'测试数据综合表',ha:'Comprehensive', do:true},
    {name:'测试情况分析和建议表',ha:'SituationSuggest', do:true},
];


interface Props  extends InternalItemProps{
    label?: string;
    config?: any[];    //有配置模式的 : 表对象的默认取值；
    zlsc?: boolean;     //有：资料审查的；
}
const 结论说明选=['不符合 TSG 91-2021要求应填写：锅炉热效率限定值为   %，使用单位应采取有效措施提高锅炉运行热效 率（节能改进建议见报告第8-9页）。',
           '符合 TSG 91-2021要求应填写：锅炉热效率限定值为   %。'];
export const itemA下结论=['检验结论','检验日期','检验日期1','结论说明',
               '依节能环','依热工性','试性质','试方法','炉出力','过量空气'];
//还要提取的?
const itemA下结论m=itemA下结论.concat([ ]);
export const ConclusionThmeff=
    React.forwardRef((
        { children, show ,alone=true,redId,nestMd,label,zlsc}:Props,  ref
    ) => {
        const defvcbFunc = React.useCallback((par: any) => {
            // if(!par.试性质)   par.试性质='在用锅炉能效简单测试';
            return  par;
        }, []);
        const [getInpFilter]=useMeasureInpFilter(null,itemA下结论m,defvcbFunc);
        const {inp, setInp} = useItemInputControl({ ref });
        return <InspectRecordLayout inp={inp} setInp={setInp} getInpFilter={getInpFilter} show={show} redId={redId}
                                    nestMd={nestMd} alone={alone} label={label!}>
            <Text variant="h5">{label}：</Text>
            测试依据&gt;&gt;
            <LineColumn >
                <InputLine label={`TSG 91-2021《锅炉节能环保技术规程》`}>
                    <CheckSwitch  checked= {inp?.依节能环 || false}
                                  onChange={e =>setInp({...inp, 依节能环: (inp?.依节能环? undefined:true)} ) } />
                </InputLine>
                <InputLine label={`GB/T 10180-2017《工业锅炉热工性能试验规程》`}>
                    <CheckSwitch  checked= {inp?.依热工性 || false}
                                  onChange={e =>setInp({...inp, 依热工性: (inp?.依热工性? undefined:true)} ) } />
                </InputLine>
            </LineColumn>
            <LineColumn >
                <InputLine  label='测试性质' >
                    <BlobInputList value={inp?.试性质 ?? ''} rows={2} datalist={['在用锅炉能效简单测试']}
                                   onListChange={v => setInp({...inp, 试性质: v || undefined}) } />
                </InputLine>
                <InputLine  label='测试方法' >
                    <BlobInputList value={inp?.试方法 ?? ''} rows={1} datalist={['反平衡法']}
                                   onListChange={v => setInp({...inp, 试方法: v || undefined}) } />
                </InputLine>
                <InputLine  label='锅炉出力'>
                    <InputDatalist value={inp?.炉出力 ||''}  datalist={['日常生产负荷',]}
                                   onListChange={v => setInp({ ...inp, 炉出力: v||undefined})} />
                </InputLine>
{/*                <InputLine  label='锅炉热效率' >
                    <SuffixInput  value={inp?.炉热效 ||''}
                                  onChange={e=>setInp({ ...inp, 炉热效: e.currentTarget.value||undefined})}>%</SuffixInput>
                </InputLine>*/}

                <InputLine label='排烟处过量空气系数'>
                    <Input value={inp?.过量空气 ?? ''}
                           onChange={e => setInp({...inp, 过量空气: e.currentTarget.value})}/>
                </InputLine>
            </LineColumn>
            <Text variant="h5">结论-测试结论{'>>'}</Text>
            <InputLine  label='测试结论' >
                <Select inputSize="md" css={{minWidth:'140px',fontSize:'1.3rem',padding:'0 1rem'}}
                        value={ inp?.检验结论  ||''} onChange={e => setInp({ ...inp, 检验结论: e.currentTarget.value||undefined}) }>
                    <option></option>
                    <option>热效率符合TSG91-2021要求（高于限定值的95%）</option>
                    <option>热效率不符合TSG91-2021要求（低于限定值的95%）</option>
                </Select>
            </InputLine>
            <LineColumn column={4}>
                <InputLine label='设置测试日期'>
                    <Input value={inp?.检验日期 || ''} type='date'
                           onChange={e => setInp({...inp, 检验日期: e.currentTarget.value})}/>
                </InputLine>
                <InputLine  label='测试起始日期' >
                    <Input  value={inp?.检验日期1 ||''}  type='date'
                            onChange={e => setInp({ ...inp, 检验日期1: e.currentTarget.value}) } />
                </InputLine>
            </LineColumn>
            结论说明:
            <BlobInputList value={inp?.结论说明 ?? ''} rows={5} datalist={结论说明选}
                           onListChange={v => setInp({...inp, 结论说明: v || undefined}) } />
        </InspectRecordLayout>;
    });
